{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# list推导式\n",
    "from SubFunc import printType\n",
    "from SubFunc import rangeNature\n",
    "\n",
    "l1 = [i for i in rangeNature(1, 3)]\n",
    "printType(l1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from SubFunc import printType\n",
    "from SubFunc import rangeNature\n",
    "\n",
    "d1 = {\n",
    "    i: u for i, u in zip(rangeNature(1, 3), rangeNature(4, 6))\n",
    "}  # 通过zip分别设定键和值的生成规则\n",
    "printType(d1)\n",
    "\n",
    "d2 = {i**2: i**3 for i in rangeNature(1, 10)}  #\n",
    "printType(d2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from SubFunc import printType\n",
    "from SubFunc import rangeNature\n",
    "\n",
    "s1 = {i**2 for i in rangeNature(1, 10)}  # 出来的set是无序的\n",
    "printType(s1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from SubFunc import printType\n",
    "from SubFunc import rangeNature\n",
    "\n",
    "t1 = (i**2 for i in rangeNature(1, 10))\n",
    "printType(t1)"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": 3
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
